package com.example.controller;

import com.example.entity.Student;
import com.example.service.StudentService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;


@Controller
public class FirstController {
    @Resource
    StudentService studentService;

    @RequestMapping("hello")
    @ResponseBody
    public String hello(){
        return "";
      //  return "redirect:/hello.html";
    }
    @RequestMapping("select")
    public String select(Model model){
        List<Student> list=studentService.select();
        model.addAttribute("list",list);
        return "forward:/success.jsp";
        //  return "redirect:/hello.html";
    }
}
